import java.util.Scanner;
public class Elaina_10_8_ti1 {
    private int a = 1;
    private int b = 3;
    private int c = 5;
    private int d = 9;
    public int ret(int x){
        if(x>=a && x<b){
            return 2*x+4;
        }
        else if(x>=b && x<c){
            return (int)Math.sqrt((double)x);
        }
        else if(x>=c && x<d){
            return x*x+3*x-6;
        }
        else return -1;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        Elaina_10_8_ti1 fun = new Elaina_10_8_ti1();
        System.out.println(fun.ret(x));
    }
}
